﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Elev.DataFactory;
using System.Windows.Media.Imaging;

namespace Elev.Utility
{
    public abstract class BaseViewModel : INotifyPropertyChanged
    {
        private static object obj = new object();

        public MoviesCenterDBEntities entity = null;

        #region
        private string videoName;
        /// <summary>
        /// 名称
        /// </summary>
        public string VideoName
        {
            get
            {
                return videoName;
            }


            set
            {
                videoName = value;
                OnPropertyChanged("VideoName");
            }
        }

        private string videoOriginalTitle;
        /// <summary>
        /// 又名
        /// </summary>
        public string VideoOriginalTitle
        {
            get
            {
                return videoOriginalTitle;
            }

            set
            {
                videoOriginalTitle = value;
                OnPropertyChanged("VideoOriginalTitle");
            }
        }

        private string videoType;
        /// <summary>
        /// 类型
        /// </summary>
        public string VideoType
        {
            get
            {
                return videoType;
            }

            set
            {
                videoType = value;
                OnPropertyChanged("VideoType");
            }
        }

        private string videoLanguage;
        /// <summary>
        /// 语言
        /// </summary>
        public string VideoLanguage
        {
            get
            {
                return videoLanguage;
            }

            set
            {
                videoLanguage = value;
                OnPropertyChanged("VideoLanguage");
            }
        }

        private BitmapImage videoImages;

        public BitmapImage VideoImages
        {
            get
            {
                return videoImages;
            }

            set
            {
                videoImages = value;
                OnPropertyChanged("VideoImages");
            }
        }

        private string videoTime;
        /// <summary>
        /// 片长
        /// </summary>
        public string VideoTime
        {
            get
            {
                return videoTime;
            }

            set
            {
                videoTime = value;
                OnPropertyChanged("VideoTime");
            }
        }

        private string videoCasts;
        /// <summary>
        /// 主演
        /// </summary>
        public string VideoCasts
        {
            get
            {
                return videoCasts;
            }

            set
            {
                videoCasts = value;
                OnPropertyChanged("VideoCasts");
            }
        }

        private string videoInfo;
        /// <summary>
        /// 简介
        /// </summary>
        public string VideoInfo
        {
            get
            {
                return videoInfo;
            }

            set
            {
                videoInfo = value;
                OnPropertyChanged("VideoInfo");
            }
        }
        #endregion

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

        public BaseViewModel()
        {
            if (entity == null)
            {
                lock (obj)
                {
                    if (entity == null)
                    {
                        entity = new MoviesCenterDBEntities();
                    }
                }
            }
        }
    }
}
